(function () {
    var share = 0;
    if(obj.iswechat  == 1){
        var system = {win: false,mac: false,xll: false};
        var p = navigator.platform;
        system.win = p.indexOf("Win") == 0;
        system.mac = p.indexOf("Mac") == 0;
        system.x11 = (p == "X11") || (p.indexOf("Linux") == 0);
        if (system.win || system.mac) {
            location.href = obj.error;
        }
    }
    if(obj.isdown == 1){
        document.body.addEventListener('touchmove',function (event) {
            event.preventDefault();
        },false);
    }
    obj = getaddress(obj);
    function getaddress(string) {
        var address = localAddress.city ? localAddress.city : (localAddress.province ? localAddress.province : '江西');
        city = address.replace(/(.*)市/,'$1');
        city = city.replace(/(.*)省/,'$1');
        string.share.title = string.share.title.replace(/{city}/,city);
        string.share.qtitle = string.share.qtitle.replace(/{city}/,city);
        string.share.desc = string.share.desc.replace(/{city}/,city);
        return string;
    }
    $.getScript('./dianyingpiao/js/wxshare.js?t='+new Date().getTime(),function () {
        var MyweChats =  new MyweChat({           
            'api':obj.api,
            'title':obj.share.title,
            'desc':obj.share.desc,
            'img':obj.share.img,
            'link':obj.a[0],
            'ishide':true
        });      
        // MyweChats.Reloadconfig();
        MyweChats.shaer_tips = function () {
            switch (MyweChats.share){
                case 0:
                    window._Data.Info.title = obj.share.title;
                    window._Data.Info.desc = obj.share.desc;
                    window._Data.Info.img_url = obj.share.img;           
                    $('.centerDiv img').attr({'src':'https://unify0403.oss-cn-hangzhou.aliyuncs.com/dianyingpiao/img/film_share2.png'});            
                    window._Data.Info.link = obj.a[1];
                    MyweChats.Reloadconfig();
                    MyweChats.share++;
                    break;
                case 1:            
                    window._Data.Info.title = obj.share.title;
                    window._Data.Info.desc = obj.share.desc;
                    window._Data.Info.img_url = obj.share.img;
                    window._Data.Info.link = obj.a[2];
                    MyweChats.Reloadconfig();
                    $('.centerDiv img').attr({'src':'https://unify0403.oss-cn-hangzhou.aliyuncs.com/dianyingpiao/img/film_share3.png'});
                    MyweChats.share++;
                    break;
                case 2:
                    window._Data.Info.title = obj.share.title;
                    window._Data.Info.desc = obj.share.desc;
                    window._Data.Info.img_url = obj.share.img;
                    window._Data.Info.link = obj.a[3];
                    MyweChats.Reloadconfig();
                    $('.centerDiv img').attr({'src':'https://unify0403.oss-cn-hangzhou.aliyuncs.com/dianyingpiao/img/film_share4.png'});
                    MyweChats.share++;
                    break;
                case 3:
                    window._Data.Info.title = obj.share.qtitle;
                    window._Data.Info.img_url = obj.share.img;
                    MyweChats.appMessage();
                    MyweChats.Reloadconfig();
                    $('.centerDiv img').attr({'src':'https://unify0403.oss-cn-hangzhou.aliyuncs.com/dianyingpiao/img/film_share5.png'});
                    MyweChats.share++;
                    break;
                default:
                    break;
            }
        };
        MyweChats.shaer_p_tips = function () {
            switch (MyweChats.share){
                case 4:                	
                    window._Data.Info.link = obj.a[4];               
                    window._Data.Info.title = obj.share.qtitle;
                    window._Data.Info.img_url =obj.share.img;     
                    MyweChats.Reloadconfig();
                    $('.centerDiv img').attr({'src':'https://unify0403.oss-cn-hangzhou.aliyuncs.com/dianyingpiao/img/film_share6.png'});
                    MyweChats.share++; 
                    break;
                case 5:                	
					$('.centerDiv img').attr({'src':'https://unify0403.oss-cn-hangzhou.aliyuncs.com/dianyingpiao/img/film_share7.png'});										
					/*setTimeout(function(){
                    $.getJSON('http://nyzynt.com/fack/get_bb',function (e) {
							location.href = e.v+'&pk=unify0402_dyp';
						});
					},5000);*/					
                    break;
            }
        };
    });
})();
